﻿@using ForzaGT3.Data
@model IEnumerable<Result> 
@{
    List<SelectListItem> SeriesList = new List<SelectListItem>();
    IEnumerable<Series> series = Series.GetAll();
    SelectListItem initItem = new SelectListItem();
    initItem.Text = "All Event";
    initItem.Value = string.Empty;
    SeriesList.Add(initItem);
    foreach (Series data in series)
    {
        SelectListItem item = new SelectListItem();
        item.Text = data.Title;
        item.Value = data.SeriesId.ToString();
        SeriesList.Add(item);
    }
}
<div class="contentheader header shadow">
    RESULTS
</div>
<div class="greybgtxt">
    <div class="greyfull">
        <div id="tab">
            <ul>
                <li><a href="#tabs-1">Season</a></li>
                <li><a href="#tabs-2">Driver</a></li>
            </ul>
            <div id="tabs-1">
                <div id="filter">
                    @Html.DropDownList("SeriesId", SeriesList)
                </div>
                <div class="results">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th align="left" scope="col">
                                EVENT
                            </th>
                            <th scope="col" align="left">
                                <img src="@Links.Assets.images.helm_png" alt="standings" style="float: left; margin-right: 5px;" />
                                DRIVERS
                            </th>
                            <th align="left" scope="col">
                                TEAM
                            </th>
                            <th align="left" scope="col">
                                POINTS
                            </th>
                            <th align="left" scope="col">
                                TIME
                            </th>
                        </tr>
                        @if (Model != null)
                        {
                            foreach (Result data in Model)
                            {
                            <tr>
                                <td align="left">
                                    <img src="@Url.Content("~" + data.Series.Circuit.Country.FlagUrl)" width="30" height="20" style="float: left; margin-right: 5px;"
                                        alt="@data.Series.Circuit.Country.Name"/>
                                    @data.Series.Circuit.Name<span>, @data.Series.StartDate.Day - @data.Series.FinishDate.ToString("dd MMM yyyy")</span>
                                </td>
                                <td align="left">
                                    @data.Driver.Name
                                </td>
                                <td align="left">
                                    @data.Driver.Team.Name
                                </td>
                                <td align="left">
                                    @data.Point
                                </td>
                                <td align="left">
                                    @data.TimeElapsed
                                </td>
                            </tr>
                            }
                        }
                    </table>
                </div>
            </div>
            <div id="tabs-2">
            </div>
        </div>
    </div>
</div>
